<?php

namespace ManiaLivePlugins\MLEPP\Jukebox\Gui\Controls\attributes;

use ManiaLib\Gui\Elements\Label;
use ManiaLib\Gui\Elements\Bgs1InRace;

use ManiaLivePlugins\MLEPP\Jukebox\Gui\Controls\Controls;

class Text extends Controls{
    
    protected $background;
    protected $label;

    function initializeComponents2(){
        
        // insert background ...
        $this->background = new Bgs1InRace($this->getSizeX(), $this->getSizeY());
        $this->background->setSubStyle(Bgs1InRace::NavButton);

        $this->addComponent($this->background);

        // insert label ...
        $this->label = new Label($this->getSizeX() - 2, $this->getSizeY());
        $this->label->setPosition(1, 1);
        $this->addComponent($this->label);
    }

    function onResize(){
        $this->background->setSize($this->getSizeX(), $this->getSizeY());
        $this->label->setSize($this->getSizeX() - 2, $this->getSizeY());
    }

    function setText($text){
        $this->label->setText($text);
    }
	
	public function destroy() {
		parent::destroy();
		gc_collect_cycles();
	}
}
?>
